/* SettingPage.css */

/* 基础样式 */
.settings-page {
  padding: 20px;
  background-color: #f9fafb;
  min-height: 100vh;
}

/* 页面头部 */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

/* 设置容器 */
.settings-container {
  display: flex;
  gap: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* 设置侧边栏 */
.settings-sidebar {
  width: 240px;
  background-color: #f9fafb;
  border-right: 1px solid #e5e7eb;
  padding: 20px 0;
}

.settings-sidebar h3 {
  padding: 0 24px 16px;
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  border-bottom: 1px solid #e5e7eb;
}

.settings-menu {
  list-style: none;
  padding: 16px 0;
  margin: 0;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  cursor: pointer;
  color: #6b7280;
  font-size: 15px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.menu-item:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.menu-item.active {
  background-color: #e0f2fe;
  color: #0369a1;
  border-left-color: #0ea5e9;
  font-weight: 500;
}

.menu-icon {
  margin-right: 12px;
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.menu-label {
  font-weight: 500;
}

/* 主内容区域 */
.settings-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content-header {
  padding: 24px 24px 0;
  border-bottom: 1px solid #e5e7eb;
}

.content-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 16px 0;
}

.content-body {
  padding: 24px;
  flex: 1;
}

/* 加载状态 */
.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
  font-size: 16px;
  color: #6b7280;
}

/* 通用设置项样式 */
.setting-group {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.setting-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.setting-label {
  display: block;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
  font-size: 15px;
}

.setting-input,
.setting-select,
.setting-textarea {
  width: 100%;
  max-width: 500px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.setting-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}

.setting-input:focus,
.setting-select:focus,
.setting-textarea:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.setting-input.error,
.setting-select.error {
  border-color: #ef4444;
}

.setting-input.error:focus,
.setting-select.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
  display: block;
  color: #ef4444;
  font-size: 13px;
  margin-top: 4px;
}

.setting-description {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.4;
}

.required {
  color: #ef4444;
  margin-left: 4px;
}

/* 复选框样式 */
.setting-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: #374151;
  padding: 8px 0;
}

.setting-checkbox-label input[type="checkbox"] {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  accent-color: #0ea5e9;
  cursor: pointer;
}

/* 按钮样式 */
.settings-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
}

.btn-save,
.btn-reset,
.btn-secondary {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  min-width: 100px;
  text-align: center;
}

.btn-save {
  background-color: #0ea5e9;
  color: white;
}

.btn-save:hover:not(:disabled) {
  background-color: #0284c7;
}

.btn-reset {
  background-color: #f3f4f6;
  color: #4b5563;
}

.btn-reset:hover {
  background-color: #e5e7eb;
}

.btn-secondary {
  background-color: #ffffff;
  color: #0ea5e9;
  border: 1px solid #0ea5e9;
}

.btn-secondary:hover {
  background-color: #f0f9ff;
}

.btn-save:disabled,
.btn-reset:disabled,
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 标签页样式 */
.settings-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 24px;
  gap: 4px;
}

.tab-button {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  border-radius: 6px 6px 0 0;
}

.tab-button:hover {
  color: #0ea5e9;
  background-color: #f9fafb;
}

.tab-button.active {
  color: #0ea5e9;
  border-bottom-color: #0ea5e9;
  font-weight: 500;
  background-color: white;
}

.tab-content {
  padding: 20px 0;
}

/* 权限列表样式 */
.permission-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
  background-color: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.permission-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
}

.permission-note {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
  padding: 12px 16px;
  background-color: #f0f9ff;
  border-radius: 6px;
  border-left: 3px solid #0ea5e9;
}

/* 头像预览样式 */
.avatar-preview {
  margin-top: 16px;
}

.avatar-preview img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 设置说明样式 */
.settings-note {
  margin-top: 32px;
  padding: 16px;
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  color: #0369a1;
  font-size: 13px;
  line-height: 1.5;
}

.settings-note p {
  margin: 0;
}

.settings-note p + p {
  margin-top: 8px;
}

/* 个性化设置分组标题 */
.personalization-settings h3,
.basic-settings h3,
.user-settings h3,
.user-settings h4 {
  color: #1f2937;
  margin-top: 32px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.personalization-settings h3:first-child,
.basic-settings h3:first-child,
.user-settings h3:first-child {
  margin-top: 0;
}

.user-settings h4 {
  font-size: 16px;
  margin-top: 24px;
  margin-bottom: 16px;
  border-bottom: none;
  color: #374151;
  padding-bottom: 8px;
  font-weight: 500;
}

/* 选择框样式 */
.theme-options,
.language-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.theme-option,
.language-option {
  flex: 1;
  min-width: 150px;
  padding: 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  background-color: white;
}

.theme-option:hover,
.language-option:hover {
  border-color: #0ea5e9;
  background-color: #f0f9ff;
}

.theme-option.selected,
.language-option.selected {
  border-color: #0ea5e9;
  background-color: #e0f2fe;
}

.theme-option-label,
.language-option-label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

.theme-option-description,
.language-option-description {
  font-size: 12px;
  color: #6b7280;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .settings-container {
    flex-direction: column;
  }
  
  .settings-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
  }
  
  .settings-sidebar h3 {
    padding: 0 16px 12px;
  }
  
  .menu-item {
    padding: 10px 16px;
  }
  
  .content-header,
  .content-body {
    padding: 16px;
  }
  
  .setting-input,
  .setting-select,
  .setting-textarea {
    max-width: 100%;
  }
  
  .settings-tabs {
    flex-wrap: wrap;
  }
  
  .tab-button {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .permission-list {
    max-height: 300px;
  }
  
  .btn-save,
  .btn-reset,
  .btn-secondary {
    flex: 1;
    padding: 8px 16px;
  }
  
  .theme-options,
  .language-options {
    flex-direction: column;
  }
  
  .theme-option,
  .language-option {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .settings-page {
    padding: 12px;
  }
  
  .content-header h2 {
    font-size: 18px;
  }
  
  .personalization-settings h3,
  .basic-settings h3,
  .user-settings h3 {
    font-size: 16px;
  }
  
  .user-settings h4 {
    font-size: 14px;
  }
  
  .settings-actions {
    flex-direction: column;
  }
}

/* 深色主题样式 */
.dark-theme {
  background-color: #111827;
  color: #f3f4f6;
}

.dark-theme .settings-page {
  background-color: #111827;
}

.dark-theme .settings-container {
  background-color: #1f2937;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.dark-theme .settings-sidebar {
  background-color: #1f2937;
  border-right-color: #374151;
}

.dark-theme .settings-sidebar h3 {
  color: #9ca3af;
  border-bottom-color: #374151;
}

.dark-theme .menu-item {
  color: #9ca3af;
}

.dark-theme .menu-item:hover {
  background-color: #374151;
  color: #e5e7eb;
}

.dark-theme .menu-item.active {
  background-color: #0f172a;
  color: #06b6d4;
  border-left-color: #06b6d4;
}

.dark-theme .content-header {
  border-bottom-color: #374151;
}

.dark-theme .content-header h2,
.dark-theme .setting-label,
.dark-theme h3,
.dark-theme h4 {
  color: #f3f4f6;
}

.dark-theme .setting-input,
.dark-theme .setting-select,
.dark-theme .setting-textarea {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark-theme .setting-input:focus,
.dark-theme .setting-select:focus,
.dark-theme .setting-textarea:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.dark-theme .setting-description,
.dark-theme .permission-note,
.dark-theme .settings-note {
  color: #9ca3af;
}

.dark-theme .permission-list {
  background-color: #374151;
  border-color: #4b5563;
}

.dark-theme .settings-note {
  background-color: #0f172a;
  border-color: #1e3a8a;
  color: #60a5fa;
}

.dark-theme .content-header,
.dark-theme .settings-actions,
.dark-theme .setting-group,
.dark-theme .settings-tabs {
  border-color: #374151;
}

.dark-theme .tab-button {
  color: #9ca3af;
}

.dark-theme .tab-button:hover {
  color: #06b6d4;
  background-color: #374151;
}

.dark-theme .tab-button.active {
  color: #06b6d4;
  border-bottom-color: #06b6d4;
  background-color: #1f2937;
}

.dark-theme .theme-option,
.dark-theme .language-option {
  background-color: #374151;
  border-color: #4b5563;
}

.dark-theme .theme-option:hover,
.dark-theme .language-option:hover {
  border-color: #06b6d4;
  background-color: #0f172a;
}

.dark-theme .theme-option.selected,
.dark-theme .language-option.selected {
  border-color: #06b6d4;
  background-color: #0f172a;
}

.dark-theme .theme-option-label,
.dark-theme .language-option-label {
  color: #e5e7eb;
}

.dark-theme .theme-option-description,
.dark-theme .language-option-description {
  color: #9ca3af;
}

.dark-theme .loading-container {
  color: #9ca3af;
}

/* 打印样式 */
@media print {
  .settings-container {
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }
  
  .settings-sidebar,
  .settings-actions {
    display: none;
  }
  
  .dark-theme {
    background-color: white;
    color: black;
  }
  
  .dark-theme .settings-container,
  .dark-theme .settings-sidebar,
  .dark-theme .setting-input,
  .dark-theme .setting-select,
  .dark-theme .setting-textarea,
  .dark-theme .permission-list,
  .dark-theme .theme-option,
  .dark-theme .language-option {
    background-color: white;
    color: black;
    border-color: #d1d5db;
  }
}

/* 动画效果 */
.setting-item,
.setting-group {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 滚动条样式 */
.permission-list::-webkit-scrollbar {
  width: 6px;
}

.permission-list::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.permission-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.permission-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.dark-theme .permission-list::-webkit-scrollbar-track {
  background: #374151;
}

.dark-theme .permission-list::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark-theme .permission-list::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}